var app = getApp();
Page({
  data: {
    expertList: [],
    url: '',
    pageNum: 1,
    totalCount:0,
  },
  selectAll() {
    let that = this
    wx.request({
      method: 'get',
      url: this.data.url + '/question/findByPage',
      data: {
        pageNum: that.data.pageNum,
        pageSize: 10
      },
      success(res) {
        console.log(res)
        that.setData({
          expertList : [...that.data.expertList,...res.data.data.list],
          totalCount:res.data.data.navigateLastPage
        })
      }
    })
  },



  onLoad: function () {
    var that = this;
    this.setData({
      url: app.globalData.URL
    })
    this.selectAll()
  },
  onReachBottom() {
    // 根据节流阀的值，来确定是否继续请求数据
    // if (this.data.isLoading) return;
    // console.log("下拉了")
    // console.log(this.data.pageNo)
    // console.log(this.data.totalCount)
    if (this.data.pageNum >= this.data.totalCount) {
      wx.showToast({
        title: '没有数据了',
      })
      return;
    }
    this.setData({
        pageNum: this.data.pageNum + 1,
      }),
      // console.log(this.data.pageNo)
      this.selectAll();
  },
})